<style>
    div#view-content h3{
        clear: both;
    }
    div#view-content br{
        clear: both;
    }
    div#view-content span{
        float: left;
        padding: 3px;
        margin: 0px 2px 2px 0px;
        width: 200px;
    }
    div#view-content span.labels{
        clear: left;
        width: 130px;
        background-color: black;
        color: white;
        font-weight: bold;
    }
</style>
<style>
    div#rejection{
        background-color: beige;
        border: 2px #0398CA ridge;
        display: none;
        position: absolute;
        padding: 20px;
        z-index: 100;
    }


    div.containerNotification{
        background-color: black;
        border-style:solid;
        border-color:#242424;
        color: whitesmoke;
        width: 300px;
        Height: 30px;
     }
</style>
<script type="text/javascript" src="<?=$this->baseUrl()?>/js/jquery.cookie.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        // get previous page then delete it
        var c = $.cookie('prevpage');
        $.cookie('prevpage',null);

        // assign the value as page when clicking back hyperlink
        if(c!=null){
            $("a#back").click(function(){
                window.location = "<?=$this->baseUrl()?>/transaction/" + c;
            });
        }

        // if the value is null, redirect to index page when clicking back hyperlink
        else{
            $("a#back").click(function(){
                window.location = "<?=$this->baseUrl()?>/transaction/index";
            });
        }
    });

    function show_receipt(){
        var myscreen = getScreen(); //screen-size.js

        var box = document.getElementById("rejection");
        box.style.height = "280px";
        box.style.width = "390px";
        box.style.top = (myscreen.height - parseInt(box.style.height))/2 + "px";
        box.style.left = (myscreen.width - parseInt(box.style.width))/2 + "px";
        box.style.display = 'block';
    }

</script>
<?php $cycle = $this->cycle(array("#99ff99","#ccffcc")); ?>
<div id="view-content">
    <h1>(<?= $this->transaction["description"] ?>)</h1>
    <?php $cycle->rewind(); ?>
    <h3>Data Toko</h3>
    <span class="labels">Nama toko</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["s_name"] ?></span>
    <span class="labels">Alamat</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["s_address"] ?></span>
    <span class="labels">Kota</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["s_city"] ?></span>
    <span class="labels">Email</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["s_email"] ?></span>
    <span class="labels">Telepon</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["s_phone"] ?></span>
    <br>
    <?php $cycle->rewind(); ?>
    <h3>Data Pemesan</h3>
    <span class="labels">Nama pemesan</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["b_name"] ?></span>
    <span class="labels">Alamat</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["b_address"] ?></span>
    <span class="labels">Email</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["b_email"] ?></span>
    <?php if(!empty($this->transaction["b_home_phone"])): ?>
    <span class="labels">Telp. rumah</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["b_home_phone"] ?></span>
    <?php endif; ?>
    <span class="labels">Telp. selular</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["b_mobile_phone"] ?></span>
    <br>
    <?php $cycle->rewind(); ?>
    <h3>Rincian</h3>
    <span class="labels">Waktu pemesanan</span>
    <span style="background-color: <?=$cycle->next()?>;"><?=date("d-M-Y H:i:s",strtotime($this->transaction["date"]))?></span>
    <span class="labels">Barang yang dibeli</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["details"] ?></span>
    <span class="labels">Total pembayaran</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["total_payment"] ?></span>
    <?php if(($this->transaction["transaction_status_id"] > 1 && $this->transaction["transaction_status_id"] < 6) || $this->transaction["transaction_status_id"] >= 7): ?>
        <span class="labels">Tanggal pembayaran</span>
        <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["payment_date"] ?></span><?=$this->formButton("prove","Bukti",array("style"=>"float:left;font-size:10px;","onClick"=>"show_receipt()"))?>
    <?php endif; ?>
    <?php if(($this->transaction["transaction_status_id"] > 3 && $this->transaction["transaction_status_id"] < 6) || $this->transaction["transaction_status_id"] >= 9): ?>
        <span class="labels">Tanggal pengambilan</span>
        <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["delivery_date"] ?></span>
    <?php endif; ?>
    <?php if($this->transaction["transaction_status_id"] == 5): ?>
        <span class="labels">Tanggal diterima</span>
        <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["last_update"] ?></span>
    <?php endif; ?>
    <?php if($this->transaction["transaction_status_id"] > 5): ?>
        <span class="labels">Tanggal pembatalan</span>
        <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["last_update"] ?></span>
    <?php endif; ?>
    <span class="labels">Penerima</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["receiver"] ?></span>
    <span class="labels">Alamat penerima</span>
    <span style="background-color: <?=$cycle->next()?>;"><?= $this->transaction["receiver_address"] ?></span>
    <br>
    <!-- to be implemented -->
    <?php if($this->transaction["transaction_status_id"] == 5): ?>
        <?php $cycle->rewind(); ?>
        <h3>Penerima Barang</h3>
        <span class="labels">Nama</span>
        <span style="background-color: <?=$cycle->next()?>;"><?= $this->receiver["name"] ?></span>
        <span class="labels">KTP/Passpor</span>
        <span style="background-color: <?=$cycle->next()?>;"><?= $this->receiver["ic_number"] ?></span>
        <span class="labels">Hubungan</span>
        <span style="background-color: <?=$cycle->next()?>;"><?= $this->receiver["relationship"] ?></span>
		<br>
    <?php endif; ?>
    <!-- -->
	<br>
    <a class="abutton" id="back" href="#" style="margin-right: 5px;">
        <img src="<?=$this->baseUrl()."/images/icons/arrow_left.png"?>" />Back
    </a>
        <div id="rejection" style="display:none;">
        <form name="frmReason" action="pending" method="POST">
            <b>tanda bukti pembayaran </b><br><br>
             <img src="<?=$this->baseUrl()?>/images/transactions/<?=$this->transaction["transaction_id"]?>.png" height="60" width="40"><br><br>
            <?php echo $this->formButton("cancel","Close",array("onClick"=>"javascript: document.getElementById('rejection').style.display = 'none';")); ?>
        </form>
    </div>
</div>